package com.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.entity.Ground;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Repository;

@Repository
@Mapper
public interface GroundMapper extends BaseMapper<Ground>{
//    @Delete("delete from preorder where g_id = #{g_id} AND t_id = #{t_id} AND p_date = #{p_date}")
//    int delPreorder(@Param("g_id") int g_id, @Param("t_id") int t_id, @Param("p_date") String p_date);
    @Insert("insert into ground(id, c_name, c_type, c_campus, cost, state) values (null, #{c_name}, #{c_type}, #{c_campus}, #{cost}, #{state})")
    int insertGround(@Param("id") int id,@Param("c_name") String c_name,@Param("c_type") String c_type,@Param("c_campus") String c_campus,@Param("cost") float cost,@Param("state") int state);

    @Update("update ground set id = #{id}, c_name = #{c_name}, c_type = #{c_type}, c_campus = #{c_campus}, cost = #{cost}, state = #{state}")
    int updateGround(@Param("id") int id,@Param("c_name") String c_name,@Param("c_type") String c_type,@Param("c_campus") String c_campus,@Param("cost") float cost,@Param("state") int state);
}